﻿using System;
using System.Web;

namespace Bpms.Log
{
    public abstract class LogAdapter
    {
        //protected log4net.ILog log;
        /// <summary>
        /// 初始化相关配置
        /// </summary>
        public static void Init()
        {
            log4net.Config.XmlConfigurator.Configure();
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(HttpContext.Current.Server.MapPath("~/config/log.config")));
        }

        /// <summary>
        /// 写日志
        /// </summary>
        /// <param name="message">日志信息</param>
        public abstract void WriteLog(string message);

        /// <summary>
        /// 写日志（同时记录相关异常信息）
        /// </summary>
        /// <param name="message">日志信息</param>
        /// <param name="exception">异常信息</param>
        public abstract void WriteLog(string message, Exception exception);
    }
}
